import time
s = open('m1_sorted.txt')
l = []
for i in s:
    l.append(int(i))
def sort(l):
    for i in range(len(l) - 1):
        k = 0
        for j in range(len(l) - 1 - i):
            if l[j] > l[j + 1]:
                l[j], l[j + 1] = l[j + 1], l[j]
                k += 1
        if k == 0:
            break
    return l
st = time.time()
l = sort(l)
fin = time.time()
print('m1_sorted', round((fin - st) * 1000), 'millseconds')
s1 = open('m2_reverse.txt')
l = []
for i in s1:
    l.append(int(i))
st1 = time.time()
l = sort(l)
fin1 = time.time()
print('m2_reverse', round((fin1 - st1) * 1000), 'millseconds')
s2 = open('m3_shuffle.txt')
l = []
for i in s2:
    l.append(int(i))
st2 = time.time()
l = sort(l)
fin2 = time.time()
print('m3_shuffle', round((fin2 - st2) * 1000), 'millseconds')
